﻿using System;
using Moe.ECamel.Common.Entities;

namespace Moe.ECamel.Client.Controllers
{
	public class EntityDetailsController<T, T2> where T : new()
	{
		public DetailsMode Mode { get; set; }
		public T Entity;
		public readonly EntityController<T, T2> Controller;

		public EntityDetailsController(DetailsMode mode, T entity, EntityController<T, T2> controller)
		{
			this.Mode = mode;
			this.Entity = entity;
			this.Controller = controller;
		}

		public ECamelError SubmitChanges()
		{
			return this.Controller.SubmitChanges(this.Entity, this.Mode);
		}
	}

	public class EntityDetailsController<T> : EntityDetailsController<T, T> where T : new()
	{
		public EntityDetailsController(DetailsMode mode, T entity, EntityController<T, T> controller)
			:base(mode, entity, controller)
		{
		}
	}
}